#include "xmpprostertask.h"
#include "constants.h"

namespace tinkle {

XmppRosterTask::XmppRosterTask(BaseTask *parent)
    : XmppTask(parent) {

}

XmppRosterTask::~XmppRosterTask() {

}

void XmppRosterTask::GetRoster() {
    XmlNode *newNode = new XmlNode(STR_IQ);
    //TODO: change jid
    (*newNode)()->SetAttrValue(STR_FROM, "jid");
    (*newNode)()->SetAttrValue(STR_TYPE, STR_GET);
    (*newNode)()->SetAttrValue(STR_ID, GenSessionId());
    ElementPtr element = (*newNode)()->AddChild(STR_QUERY);
    element->DeclNameSpace(NS_ROSTER, "");
    printf ("Send: %s\n", newNode->Dump().c_str());
    SendStanza(newNode);
}

bool XmppRosterTask::NextStanza(XmlNode *stanza) {
    return false;
}

void XmppRosterTask::ProcessReady() {

}

}